#include <iostream>
#include <vector>
#include <string>
using namespace std;

template<class T>
void _Purge_Sq(vector<T>& L)
{
	for (int i = 0; i < L.size(); i++)
		for (int j = i + 1; j < L.size();)
			if (L[i] != L[j]) j++;
			else L.erase(L.begin() + j);
}

template<class T>
void Purge_Sq(T a)
{
	vector<T> v;
	T tmp;
	while (cin >> tmp)
		v.push_back(tmp);
	int jug = 0;
	for (const auto& e : v)
	{
		if (jug) cout << ',';
		jug = 1;
		cout << e;
	}	cout << endl;
	cout << endl;
	_Purge_Sq(v);
	jug = 0;
	for (const auto& e : v)
	{
		if (jug) cout << ',';
		jug = 1;
		cout << e;
	}
}

int main()
{
	int t; cin >> t;
	if (t < 0 || t > 3) cout << "err";
	else if(t == 0)
		Purge_Sq(int());
	else if (t == 1)
		Purge_Sq(double());
	else if (t == 2)
		Purge_Sq(char());
	else if (t == 3)
		Purge_Sq(string());
	return 0;
}